package cn.lmxdev.ptms.bean.exception;

import cn.lmxdev.ptms.enumeration.IBizHttpState;
import cn.lmxdev.ptms.enumeration.impl.BizHttpStateImpl;
import lombok.*;
import lombok.experimental.Accessors;

@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
@ToString
@Accessors(chain = true)
public class BizException extends RuntimeException {
    private Integer code = null;
    private String msg = null;

    public BizException(IBizHttpState bizHttpState) {
        super(bizHttpState.getMsg());
        this.code = bizHttpState.getCode();
        this.msg = bizHttpState.getMsg();
    }

    public BizException(String msg) {
        super(msg);
        this.code = BizHttpStateImpl.NO.getCode();
        this.msg = msg;
    }
}